const express = require('express');
const router = express.Router();

const data = [];
for(let i = 1; i < 51; i++)
    data.push({
        id: `string${i}`,
        code: `string${i}`,
        dealerCode: 'string',
        dealerName: 'string',
        partShipmentCode: 'string',
        sapDeliveryOrderCode: 'string',
        status: 1,
        receiptDate: '2019-04-16T05:51:29.398Z',
        saleOrderCode: 'string',
        typeName: 'string',
        inspectorName: 'string',
        contactPhone: 'string',
        createTime: '2019-04-16T05:51:29.398Z',
        submitTime: '2019-04-16T05:51:29.398Z',
        firstApproveTime: '2019-04-16T05:51:29.398Z',
        disposeTime: '2019-04-16T05:51:29.398Z',
        finalApproveTime: '2019-04-16T05:51:29.398Z',
        rowVersion: 'string',
        options: [
            'submit',
            'update',
            'abandon',
            'firstApprove',
            'handle',
            'finalApprove'
        ]
    });


router.get('/forCurrentUser', (req, res) => {
    res.json(
        {
            message: '',
            payload: {
                content: data,
                totalElements: 50,
            }
        }
    );
});
router.get('/export', (req, res) => {
    setTimeout(() => {
        res.json({
            message: '导出成功',
            payload: 'Mock导出'
        });
    }, 1000);
});


router.get('/:id', (req, res) => {
    res.json(
        {
            message: 'string',
            payload: {
                id: 'string',
                code: 'string',
                dealerCode: 'string',
                dealerName: 'string',
                partShipmentId: 'string',
                partShipmentCode: 'string',
                sapDeliveryOrderCode: 'string',
                receiptDate: '2019-04-16T06:04:03.596Z',
                dealerPartWarehouseId: 'string',
                dealerPartWarehouseName: 'string',
                saleOrderCode: 'string',
                typeName: 'string',
                inspectorName: 'string',
                contactPhone: 'string',
                applyReason: 'string',
                status: 1,
                rejectStatus: 1,
                rejectComment: 'string',
                creatorName: 'string',
                createTime: '2019-04-16T06:04:03.596Z',
                modifierName: 'string',
                modifyTime: '2019-04-16T06:04:03.596Z',
                submitorName: 'string',
                submitTime: '2019-04-16T06:04:03.596Z',
                firstApproverName: 'string',
                firstApproveTime: '2019-04-16T06:04:03.596Z',
                firstApproveComment: 'string',
                disposerName: 'string',
                disposeTime: '2019-04-16T06:04:03.596Z',
                dealMethodResult: 'string',
                finalApproverName: 'string',
                finalApproveTime: '2019-04-16T06:04:03.596Z',
                finalApproveComment: '审核',
                abandonerName: 'string',
                abandonTime: '2019-04-16T06:04:03.596Z',
                rowVersion: 'string',
                options: [
                    'submit',
                    'update',
                    'abandon',
                    'firstApprove',
                    'handle',
                    'finalApprove'
                ],
                attachments: [
                    {
                        fileId: 'string',
                        fileName: 'string'
                    }
                ],
                details: [
                    {
                        partId: 'string1',
                        partCode: 'string1',
                        partName: 'string1',
                        shipQuantity: 10,
                        claimQuantity: 10,
                        claimReason: 1,
                        dealMethod: 1,
                        remark: 'string'
                    },
                    {
                        partId: 'string2',
                        partCode: 'string2',
                        partName: 'string2',
                        shipQuantity: 10,
                        claimQuantity: 10,
                        claimReason: 1,
                        remark: 'string'
                    }
                ]
            }
        }
    );
});


router.post('/', (req, res) => {
    res.json(
        {
            message: '成功'
        }
    );
});


router.put('/:id', (req, res) => {
    res.json(
        {
            message: '成功'
        }
    );
});

router.put('/:id/abandon', (req, res) => {
    res.json(
        {
            message: '成功作废'
        }
    );
});


router.put('/:id/submit', (req, res) => {
    res.json(
        {
            message: '成功提交'
        }
    );
});

router.put('/:id/pass', (req, res) => {
    res.json(
        {
            message: '初审通过'
        }
    );
});

router.put('/:id/reject', (req, res) => {
    res.json(
        {
            message: '初审不通过'
        }
    );
});

router.put('/:id/return', (req, res) => {
    res.json(
        {
            message: '初审驳回'
        }
    );
});

router.put('/:id/handle', (req, res) => {
    res.json(
        {
            message: '处理成功'
        }
    );
});

router.put('/:id/finalPass', (req, res) => {
    res.json(
        {
            message: '终审通过'
        }
    );
});

router.put('/:id/finalReject', (req, res) => {
    res.json(
        {
            message: '终审不通过'
        }
    );
});

router.put('/:id/finalReturn', (req, res) => {
    res.json(
        {
            message: '终审驳回'
        }
    );
});
module.exports = router;
